home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 2 / CD ACTUAL VOL 2.iso / docs / mini / man-page < prev    next >
Encoding:
Text File  |  1995-09-10  |  30.3 KB  |  765 lines

  1.  
  2.                        THE LINUX MAN-PAGE-HOWTO
  3.  
  4.    Copyright 1995 by Jens Schweikhardt <jens@kssun3.rus.uni-stuttgart.de>
  5.             See further information on copying conditions below.
  6.  
  7.                          Last update: July 1995
  8.                  Corrections and suggestions welcome!
  9.  
  10.    This HOWTO explains what you should bear in mind when you are going
  11.    to write on-line documentation -- a so called man page -- that you
  12.    want to make accessible via the man(1) command.
  13.  
  14.    Table of contents:
  15.    ------------------
  16.  
  17.    0)  A few thoughts on documentation
  18.    1)  How are man pages accessed?
  19.    2)  How should a formatted man page look like?
  20.    3)  How do I document several programs/functions in a single man page?
  21.    4)  Which macro package should I use?
  22.    5)  What preprocessors may I use?
  23.    6)  Should I distribute source and/or already formatted documentation?
  24.    7)  What are the font conventions?
  25.    8)  How do I polish my man page?
  26.    9)  How do I get a plain text man page without all that ^H^_ stuff?
  27.   10)  How do I get a high quality PostScript manual page?
  28.   11)  How do I get apropos and whatis to work?
  29.  
  30.    A)  Copying conditions
  31.  
  32.  
  33.  
  34.  0)   A few thoughts on documentation
  35.  ====================================
  36.  
  37.  Why do we write documentation? Silly question. Because we want others to
  38.  be able to use our program, library function or whatever we have written
  39.  and made available. But writing documentation is not all there is to it:
  40.  
  41.  + documentation must be accessible.
  42.    If it's hidden in some non-standard place where the documentation
  43.    related tools won't find it -- how can it serve its purpose?
  44.  
  45.  + documentation must be reliable and accurate.
  46.    There's nothing more annoying than having program behaviour and
  47.    documentation disagree. Users will curse you, send you hate mail and
  48.    throw your work into the bit bucket, with the firm intent to never
  49.    install anything written by that jerk again.
  50.  
  51.  The historical and well known way documentation is accessed on UNIX
  52.  is via the man(1) command. This HOWTO describes what you have to do to
  53.  write a man page that will be correctly processed by the documentation
  54.  related tools. The most important of these tools are man(1), xman(1x),
  55.  apropos(1), makewhatis(8) and catman(8).
  56.  
  57.  Reliability and accuracy of the information are, of course, up to you.
  58.  But even in this respect you will find some ideas below that help you
  59.  avoid some common glitches.
  60.  
  61.  1)   How are man pages accessed?
  62.  ================================
  63.  
  64.  You need to know the precise mechanism how man pages are accessed
  65.  in order to give your man page the right name and install it in the
  66.  right place.  Any manual page belongs to a specific section, which is
  67.  denoted by a single character. The most common sections under Linux
  68.  and their human readable names are
  69.  
  70.  Section   The human readable name
  71.  
  72.     1      User commands that may be started by everyone.
  73.     2      System calls, that is, functions provided by the kernel.
  74.     3      Subroutines, that is, library functions.
  75.     4      Devices, that is, special files in the /dev directory.
  76.     5      File format descriptions, e.g. /etc/passwd.
  77.     6      Games, self-explanatory.
  78.     7      Miscellaneous, e.g. macro packages, conventions.
  79.     8      System administration tools that only root can execute.
  80.     9      Another (Linux specific) place for kernel routine documentation.
  81.     n      New documentation, that may be moved to a more appropriate section.
  82.     o      Old documentation, that may be kept for a grace period.
  83.     l      Local documentation referring to this particular system.
  84.  
  85.  The name of the source file for a man page (the input to the formatting
  86.  system) is the name of the command, function or file name, followed by
  87.  a dot, followed by the section. If you write the documentation on the
  88.  format of the `passwd' file you have to name the source file `passwd.5'.
  89.  Here we also have an example of a file name that is the same as a
  90.  command name. There might be even a library subroutine named passwd.
  91.  Sectioning is the usual way to resolve these ambiguities: The command
  92.  description is found in the file `passwd.1' and the hypo- thetical
  93.  library subroutine in `passwd.3'.
  94.  
  95.    Sometimes additional characters are appended and the file name looks
  96.    for example like `xterm.1x' or `wish.1tk'. The intent is to indicate
  97.    that this is documentation for an X Window program or a Tk application,
  98.    respectively. Some manual browsers can make use of this additional
  99.    information. For example xman will use `xterm(x)' and `wish(tk)' in
  100.    the list of available documentation.
  101.  
  102.  Beware of name clashes with existing programs, functions or file names.
  103.  It is certainly a bad idea to write yet another editor and call it
  104.  ed, sed (for smart ed) or red (for Rocky's ed). By making sure your
  105.  program's name is unique you avoid that someone executes your program
  106.  and reads someone else's man page or vice versa. Checking out the lsm
  107.  database on a program name is a place to start doing so.
  108.  
  109.  Now we know the name to give our file. The next decision is which
  110.  directory it will finally get installed (say, when the user runs
  111.  `make install' for your package.)  On Linux, all man pages are
  112.  below directories mentioned in the environment variable MANPATH. The
  113.  doc related tools use it quite similar like the shell uses PATH to
  114.  locate executables. In fact, MANPATH has the same format as PATH.
  115.  Both hold a colon separated list of directories (with the exception
  116.  that MANPATH does not allow empty fields and relative pathnames but
  117.  has absolute names only.) If MANPATH is not set or not exported, a
  118.  default will be used that contains at least the /usr/man directory.
  119.  To speed up the search and to keep directories small, the directories
  120.  specified by MANPATH (the so called base directories) contain a bunch
  121.  of subdirectories named `man<s>' where <s> stands for the one character
  122.  section introduced in the table above. Not all of the sections may
  123.  be represented by a subdirectory because there simply is no reason to
  124.  keep an empty `mano' subdirectory. However, there may be directories
  125.  named `cat<s>', `dvi<s>' and `ps<s>' which hold documentation that is
  126.  ready to display or print. More on this later.  The only other file
  127.  in any base directory should be a file named `whatis'. The purpose
  128.  and creation of this file will also be described under paragraph 11).
  129.  The safest way to have a manual page for section <s> installed in
  130.  the right place is to put it in the directory /usr/man/man<s>. A good
  131.  Makefile, however, will allow the user to chose a base directory, by
  132.  means of a make variable, MANDIR, say. Most of the GNU packages can be
  133.  configured with the --prefix=/what/ever option. The manuals will then
  134.  be installed under the base directory /what/ever/man. I suggest you
  135.  also provide a way to do something similar.
  136.  
  137.    With the advent of the Linux File System Standard (FS-Stnd), things
  138.    became more complicated. The FS-Stnd 1.2 states that "Provisions must
  139.    be made in the structure of /usr/man to support manual pages which
  140.    are written in different (or multiple) languages." This is achieved
  141.    by introducing another directory level that distinguishes between
  142.    different languages. Quoting again from FS-Stnd 1.2:
  143.  
  144.    "This naming of language subdirectories of /usr/man is based on
  145.    Appendix E of the POSIX 1003.1 standard which describes the locale
  146.    identification string -- the most well accepted method to describe
  147.    a cultural environment. The <locale> string is:
  148.  
  149.        <language>[_<territory>][.<character-set>][,<version>]"
  150.  
  151.    (See the FS-Stnd for a few common <locale> strings.)
  152.    According to these guidelines, we have our manuals in
  153.    /usr/man/<locale>/man[1-9lno]. The formatted versions should then be
  154.    in /usr/man/<locale>/cat[1-9lno] of course, otherwise we could only
  155.    provide them for a single locale.
  156.  
  157.    HOWEVER, I can not recommend switching to that structure at this time.
  158.    The FS-Stnd 1.2 also allows that "Systems which use a unique language
  159.    and code set for all manual pages may omit the <locale> substring and
  160.    store all manual pages in <mandir>. For example, systems which only
  161.    have English manual pages coded with ASCII, may store manual pages
  162.    (the man[1-9] directories) directly in /usr/man. (That is the traditional
  163.    circumstance and arrangement in fact.)"
  164.  
  165.    I would not switch until all tools (like xman, tkman, info and many
  166.    others that read manual pages) can cope with the new structure.
  167.  
  168.  
  169.  2)   How should a formatted man page look like?
  170.  ===============================================
  171.  
  172.  Let me present you an example. Below I will explain it in detail.
  173.  Due to the nature of this document, it can't show the different typefaces
  174.  (bold and italics). Please refer to the paragraph "What are the font
  175.  conventions?" for further explanations.
  176.  
  177.  Here comes the man page for the (hypothetical) foo program. 
  178.  
  179.  
  180.  
  181. FOO(1)                     User Manuals                    FOO(1)
  182.  
  183.  
  184. NAME
  185.        foo - frobnicate the bar library
  186.  
  187. SYNOPSIS
  188.        foo [-bar] [-c config-file ] file ...
  189.  
  190. DESCRIPTION
  191.        foo  frobnicates the bar library by tweaking internal sym-
  192.        bol tables. By default it  parses  all  baz  segments  and
  193.        rearranges  them in reverse order by time for the xyzzy(1)
  194.        linker to find them. The symdef entry is  then  compressed
  195.        using  the WBG (Whiz-Bang-Gizmo) algorithm.  All files are
  196.        processed in the order specified.
  197.  
  198. OPTIONS
  199.        -b     Do not write `busy' to stdout while processing.
  200.  
  201.        -c config-file
  202.               Use the alternate system wide  config-file  instead
  203.               of /etc/foo.conf.  This overrides any FOOCONF envi-
  204.               ronment variable.
  205.  
  206.        -a     In addition to the baz  segments,  also  parse  the
  207.               blurfl headers.
  208.  
  209.        -r     Recursive  mode.  Operates  as fast as lightning at
  210.               the expense of a megabyte of virtual memory.
  211.  
  212. FILES
  213.        /etc/foo.conf
  214.               The system wide configuration file. See foo(5)  for
  215.               further details.
  216.        ~/.foorc
  217.               Per user configuration file. See foo(5) for further
  218.               details.
  219.  
  220. ENVIRONMENT
  221.        FOOCONF
  222.               If non-null the full pathname for an alternate sys-
  223.               tem wide foo.conf.  Overridden by the -c option.
  224.  
  225. DIAGNOSTICS
  226.        The following diagnostics may be issued on stderr:
  227.  
  228.        Bad magic number.
  229.               The  input file does not look like an archive file.
  230.        Old style baz segments.
  231.               foo can only handle new style baz  segments.  COBOL
  232.               object libraries are not supported in this version.
  233.  
  234. BUGS
  235.        The command name should have been chosen more carefully to
  236.        reflect its purpose.
  237.  
  238. AUTHOR
  239.        Jens Schweikhardt <jens@kssun3.rus.uni-stuttgart.de>
  240.  
  241. SEE ALSO
  242.        bar(1), foo(5), xyzzy(1)
  243.  
  244.  
  245. Linux                       MARCH 1995                          1
  246.  
  247.  
  248.  
  249.  Here's the explanation as I promised.
  250.  
  251.  
  252.       The NAME section
  253.  
  254.  ...is the only required section. Man pages without a name section are
  255.  as useful as refrigerators at the north pole. This section also has
  256.  a standardized format consisting of a comma separated list of program
  257.  or function names followed by a dash followed by a short (usually one
  258.  line) description what functionality the program (function, file) is
  259.  supposed to provide. By means of makewhatis(8) the name sections make
  260.  it into the whatis database files. Makewhatis is the reason why the name
  261.  section must exist and why it must adhere to the format I described. In
  262.  the groff source it must look like
  263.  
  264.      .SH NAME
  265.      foo \- frobnicate the bar library
  266.  
  267.  The \- is of importance here. The backslash is needed to make the dash
  268.  distinct from a hyphenation dash that may appear in either the command
  269.  name or the one line description.
  270.  
  271.  
  272.       The SYNOPSIS section
  273.  
  274.  ...is intended to give a short overview on available program options.
  275.  For functions this sections lists corresponding include files and the
  276.  prototype so the programmer knows the type and number of arguments as
  277.  well as the return type.
  278.  
  279.  
  280.       The DESCRIPTION section
  281.  
  282.  ...gives an eloquent explanation why your sequence of 0s and 1s is worth
  283.  anything at all. Here's where you write down all your knowledge. This is
  284.  the Hall Of Fame. Win other programmer's and user's admiration by making
  285.  this section the source of reliable and detailed information. Explain
  286.  what the arguments are for, the file format, what algorithms do the
  287.  dirty jobs.
  288.  
  289.  
  290.       The OPTIONS section
  291.  
  292.  ...gives a description for any option how it affects program behaviour.
  293.  You knew that, didn't you?
  294.  
  295.  
  296.       The FILES section
  297.  
  298.  ...lists files the program or function uses. For example, configuration
  299.  files, startup files, files the program directly operates on. It is
  300.  a good idea to give the full pathname of these files and to make the
  301.  install process modify the directory part to match user preferences: the
  302.  groff manuals have a default prefix of /usr/local, so they reference
  303.  /usr/local/lib/groff/* by default. However, if you install using
  304.  'make prefix=/opt/gnu' the references in the man page change to
  305.  /opt/gnu/lib/groff/*
  306.  
  307.  
  308.       The ENVIRONMENT section
  309.  
  310.  ...lists all environment variables that affect your program or
  311.  function and tells how, of course. Most commonly the variables will
  312.  hold pathnames, filenames or default options.
  313.  
  314.  
  315.       The DIAGNOSTICS section
  316.  
  317.  ...should give an overview of the most common error messages from your
  318.  program and how to cope with them. There's no need to explain system
  319.  error error messages (from perror(3)) or fatal signals (from psignal(3))
  320.  as they can appear during execution of any program.
  321.  
  322.  
  323.       The BUGS section
  324.  
  325.  ...should ideally be non-existent. If you're brave, you can describe
  326.  here limitations, known inconveniences, features that others may regard
  327.  as misfeatures. If you're not so brave, rename it the TO DO section ;-)
  328.  
  329.  
  330.       The AUTHOR section
  331.  
  332.  ...is nice to have in case there are gross errors in the documentation
  333.  or program behaviour (Bzzt!) and you want to mail a bug report.
  334.  
  335.  
  336.       The SEE ALSO section
  337.  
  338.  ...is a list of related manual pages in alphabetical order.
  339.  Conventionally, it is the last section.
  340.  
  341.  
  342.  You are free to invent other sections if they really don't fit in one
  343.  of those described so far.
  344.  
  345.   So how exactly did you generate that man page?
  346.   I expected that question, here's the source, Luke:
  347.  
  348.  
  349. .\" Process this file with
  350. .\" groff -man -Tascii foo.1
  351. .\"
  352. .TH FOO 1 "MARCH 1995" Linux "User Manuals"
  353. .SH NAME
  354. foo \- frobnicate the bar library
  355. .SH SYNOPSIS
  356. .B foo [-bar] [-c
  357. .I config-file
  358. .B ]
  359. .I file
  360. .B ...
  361. .SH DESCRIPTION
  362. .B foo
  363. frobnicates the bar library by tweaking internal
  364. symbol tables. By default it parses all baz segments
  365. and rearranges them in reverse order by time for the
  366. .BR xyzzy (1)
  367. linker to find them. The symdef entry is then compressed
  368. using the WBG (Whiz-Bang-Gizmo) algorithm.
  369. All files are processed in the order specified.
  370. .SH OPTIONS
  371. .IP -b
  372. Do not write `busy' to stdout while processing.
  373. .IP "-c config-file"
  374. Use the alternate system wide
  375. .I config-file
  376. instead of
  377. .IR /etc/foo.conf .
  378. This overrides any
  379. .B FOOCONF
  380. environment variable.
  381. .IP -a
  382. In addition to the baz segments, also parse the
  383. blurfl headers.
  384. .IP -r
  385. Recursive mode. Operates as fast as lightning
  386. at the expense of a megabyte of virtual memory.
  387. .SH FILES
  388. .I /etc/foo.conf
  389. .RS
  390. The system wide configuration file. See
  391. .BR foo (5)
  392. for further details.
  393. .RE
  394. .I ~/.foorc
  395. .RS
  396. Per user configuration file. See
  397. .BR foo (5)
  398. for further details.
  399. .SH ENVIRONMENT
  400. .IP FOOCONF
  401. If non-null the full pathname for an alternate system wide
  402. .IR foo.conf .
  403. Overridden by the
  404. .B -c
  405. option.
  406. .SH DIAGNOSTICS
  407. The following diagnostics may be issued on stderr:
  408.  
  409. Bad magic number.
  410. .RS
  411. The input file does not look like an archive file.
  412. .RE
  413. Old style baz segments.
  414. .RS
  415. .B foo
  416. can only handle new style baz segments. COBOL
  417. object libraries are not supported in this version.
  418. .SH BUGS
  419. The command name should have been chosen more carefully
  420. to reflect its purpose.
  421. .SH AUTHOR
  422. Jens Schweikhardt <jens@kssun3.rus.uni-stuttgart.de>
  423. .SH "SEE ALSO"
  424. .BR bar (1),
  425. .BR foo (5),
  426. .BR xyzzy (1)
  427.  
  428.  
  429.  
  430.  
  431.  
  432.   3) How do I document several programs/functions in a single man page?
  433.      ==================================================================
  434.  
  435.   Many programs (grep, egrep) and functions (printf, fprintf, ...) are
  436.   documented in a single man page. However, these man pages would be
  437.   quite useless if they were only accessible under one name. We can not
  438.   expect a user to remember that the egrep man page is actually the grep
  439.   man page. It is therefore necessary to have the man page available
  440.   under different names. You have several possibilities to achieve this:
  441.  
  442.   1) have identical copies for each name.
  443.   2) connect all man pages using hard links.
  444.   3) symbolic links pointing to the actual man page.
  445.   4) use groff's `source' mechanism provided by the `.so' macro.
  446.  
  447.   The first way is obviously a waste of disk space. The second is not
  448.   recommended because intelligent versions of the catman program can save
  449.   a lot of work by looking at the the file type or contents.  Hard links
  450.   will prevent catman from being clever. (catman's purpose is to format
  451.   all man pages so that they can be displayed more quickly.) The third
  452.   alternative has a slight drawback: if portability is a concern, you
  453.   have to be aware that there are operating systems that do not support
  454.   symbolic links. The upshot of this is that the Best Thing (TM) is
  455.   using groff's source mechanism.
  456.  
  457.   Here's how to do it:
  458.   If you want to have your man page available under the names `foo' and
  459.   `bar' in section 1, then put the man page in foo.1 and have bar.1 look
  460.   like this:
  461.  
  462.          .so man1/foo.1
  463.  
  464.   It is important to specify the `man1/' directory part as well as the
  465.   file name `foo.1' because when groff is run by the browser it will
  466.   have the manual base directory as its current working directory (cwd)
  467.   and groff interprets .so arguments relative to the cwd.
  468.  
  469.   4)   Which macro package should I use?
  470.   ======================================
  471.  
  472.   There are a number of macro packages especially designed for use in
  473.   writing man pages. Usually they are in the groff macro directory
  474.   /usr/lib/groff/tmac.  The file names are tmac.<something>, where
  475.   <something> is the argument to groff's -m option. Groff will use
  476.   tmac.<something> when it is given the `-m <something>' option. Often
  477.   the blank between `-m' and `<something>' is omitted so we may say
  478.   `groff -man' when we are formatting man pages using the tmac.an
  479.   macro package. That's the reason for the strange name `tmac.an'.
  480.   Besides tmac.an there is another popular macro package, tmac.doc,
  481.   which originated at the University of California at Berkeley. Many
  482.   BSD man pages use it and it seems that UCB has made it its standard
  483.   for documentation.  The tmac.doc macros are much more flexible but
  484.   alas, there are manual browsers that will not use them but always call
  485.   groff -man. For example, all xman programs I have seen will screw up
  486.   on man pages requiring tmac.doc.  So do yourself a favor: use tmac.an
  487.   -- use of any other macro package is considered harmful. Tmac.andoc is
  488.   a pseudo macro package that takes a look at the source and then loads
  489.   either tmac.an or tmac.doc. Actually any man page browser should use
  490.   it but until now not all of them do, so it is best we cling to ye olde
  491.   tmac.an. Anything I tell you from now on and concerning macros only
  492.   holds true for tmac.an.
  493.  
  494.  
  495.   5)   What preprocessors may I use?
  496.   ==================================
  497.  
  498.   Groff comes with at least three preprocessors, tbl, eqn, and pic (on
  499.   some systems they are named gtbl, geqn and gpic.) Their purpose is to
  500.   translate preprocessor macros and their data to regular troff input.
  501.   Tbl is a table preprocessor, eqn is an equations/maths preprocessor
  502.   and pic is a picture preprocessor. Please refer to the man pages for
  503.   more information on what functionality they provide.
  504.  
  505.   To put it in a nutshell: don't write man pages requiring ANY preprocessor.
  506.  
  507.   Eqn will generally produce terrible output for typewriter-like devices,
  508.   unfortunately the type of device 99% of all man pages are viewed on.
  509.   For example, XAllocColor.3x uses a few formulas with exponentiation.
  510.   Due to the nature of typewriter-like devices the exponent will be on
  511.   the same line as the base. N to the power of two appears as `N2'.
  512.  
  513.   Tbl should be avoided because all xman programs I have seen fail
  514.   on them.  Xman 3.1.6 uses the following command to format man pages,
  515.   e.g. signal(7):
  516.  
  517.     gtbl /usr/man/man7/signal.7 | geqn | gtbl | groff -Tascii -man \
  518.     > /tmp/xmana01760 2> /dev/null
  519.  
  520.   which screws up for sources using gtbl, because gtbl output is
  521.   fed again into gtbl. The effect is a man page without your table.
  522.   I don't know if it's a bug or a feature that gtbl chokes on its own
  523.   output or if xman could be a little smarter not using gtbl twice...
  524.   Anyway, if you want a table, format it yourself and put it between
  525.   .nf .fi lines so that it will be left unformatted. You won't have bold
  526.   and italics this way but this beats having your table swallowed any day.
  527.  
  528.   I have yet to see a man page requiring pic preprocessing. But I would
  529.   not like it. As you can see above, xman will not use it and groff will
  530.   certainly do the funky wadakiki on the input.
  531.  
  532.  
  533.  
  534.   6)   Should I distribute source and/or already formatted documentation?
  535.   =======================================================================
  536.  
  537.   Let me give the pros (+) and cons (-) of a few selected possibilities:
  538.   1) Source only:
  539.      + smaller distribution package.
  540.      - inaccessible on systems without groff.
  541.   2) Uncompressed formatted only: 
  542.      + accessible even on systems without groff.
  543.      - the user can't generate a dvi or postscript file.
  544.      - waste of disk space on systems that also handle compressed pages.
  545.   3) Compressed formatted only:
  546.      + accessible even on systems without groff.
  547.      - the user can't generate a dvi or postscript file.
  548.      - which compression format would you use? .Z? .z? .gz? All of them?
  549.   4) Source and uncompressed formatted:
  550.      + accessible even on systems without groff.
  551.      - larger distribution package
  552.      - some systems may expect compressed formatted man pages.
  553.      - redundant information on systems equipped with groff.
  554.  
  555.   IMHO it is best to distribute source only. The argument that it's
  556.   inaccessible on systems without groff does not matter. The 500+ man
  557.   pages of the Linux Documentation Project are source only. The man
  558.   pages of XFree86 are source only. The man pages from the FSF are source
  559.   only. In fact, I have rarely seen software distributed with formatted
  560.   man pages. If any sysadmin is really concerned about having man pages
  561.   accessible then he also has groff installed.
  562.  
  563.  
  564.  
  565.   7)   What are the font conventions?
  566.   ===================================
  567.  
  568.   First of all: don't use direct font operators like \fB \fP etc. Use
  569.   macros which take arguments. This way you avoid a common glitch:
  570.   forgetting the font change at the end of the word and having the bold
  571.   or italic extend up to the next font change. Believe me, it happens
  572.   more often than you think.
  573.  
  574.   The tmac.an macros provide the following type faces:
  575.  
  576.        .B      Bold
  577.        .BI     Bold alternating with italics
  578.        .BR     Bold alternating with Roman
  579.        .I      Italics
  580.        .IB     Italics alternating with bold
  581.        .IR     Italics alternating with Roman
  582.        .RB     Roman alternating with bold
  583.        .RI     Roman alternating with italics
  584.        .SM     Small (scaled 9/10 of the regular size)
  585.        .SB     Small bold (NOT small alternating with bold)
  586.  
  587.   X alternating with Y means that the odd arguments are typeset in X
  588.   while the even arguments are typeset in Y. For example
  589.   .BI "Arg 1 is Bold, " "Arg 2 is Italics, " "and Bold, " "and Italics."
  590.   The double quotes are needed to include white space into an argument.
  591.  
  592.   So much for what's available. Here's how you should make use of the
  593.   different typefaces: (portions shamelessly stolen from man(7))
  594.  
  595.   Although there are many arbitrary conventions for man pages in the
  596.   UNIX world, the existence of several hundred Linux-specific man pages
  597.   defines our standards:
  598.  
  599.   For functions, the arguments are always specified using italics, even
  600.   in the SYNOPSIS section, where the rest of the function is specified
  601.   in bold:
  602.  
  603.       .BI "myfunction(int " argc ", char **" argv );
  604.  
  605.   Filenames are always in italics, except in the SYNOPSIS section, where
  606.   included files are in bold. So you should use
  607.  
  608.       .I /usr/include/stdio.h and
  609.       .B #include <stdio.h>
  610.  
  611.   Special macros, which are usually in upper case, are in bold:
  612.  
  613.       .B MAXINT
  614.  
  615.   When enumerating a list of error codes, the codes are in bold. This
  616.   list usually uses the .TP (paragraph with hanging tag) macro as follows:
  617.  
  618.       .TP
  619.       .B EBADF
  620.       .I fd
  621.       is not a valid file descriptor.
  622.       .TP
  623.       .B EINVAL
  624.       .I fd
  625.       is unsuitable for reading
  626.  
  627.   Any reference to another man page (or to the subject of the current
  628.   man page) is in bold. If the manual section number is given, it is
  629.   given in roman, without any spaces:
  630.  
  631.       .BR man (7)
  632.  
  633.   Acronyms look best when typeset in small type face. So I recommend
  634.       .SM UNIX     .SM ASCII     .SM TAB      .SM NFS      .SM LALR(1)
  635.  
  636.   8)   Polishing your man page
  637.   ============================
  638.  
  639.   Following are some guidelines that increase reliability, readability
  640.   and 'formatability' of your documentation.
  641.  
  642.   + Test examples if they work (use cut and paste to give your shell the
  643.     exact wording from the man page) read output of your command into
  644.     your man page, don't type what you THINK your program will print.
  645.  
  646.   + Proof read, ispell, have someone else read it, especially if you are
  647.     not a native English speaker. The HOWTO you are reading by now has
  648.     not yet passed the latter test. Do you want to volunteer?
  649.  
  650.   + Test your man page: Does groff complain when you format your man page?
  651.     It's nice to have the groff command line in a comment.  Does the
  652.     man(1) command complain when you call `man yourprog'?  Does the way
  653.     how man(1) uses the formatting system produce the expected result?
  654.     Will xman(1x) and tkman(1tk) cope with your manual?  XFree86 3.1
  655.     has xman 3.1.6 - X11R6, it will try to uncompress using
  656.  
  657.         gzip -c -d < %s > %s
  658.         zcat < %s > %s
  659.  
  660.   + Will makewhatis(8) be able to extract the one-line description
  661.     from the NAME section?
  662.  
  663.  
  664.  
  665.   9)  How do I get a plain text man page without all that ^H^_ stuff?
  666.       ===============================================================
  667.  
  668.   Have a look at col(1), col can filter out backspace sequences. Just in
  669.   case you can't wait that long: 
  670.  
  671.   funnyprompt% groff -t -e -mandoc -Tascii manpage.1 | col -bx > manpage.txt
  672.  
  673.   The -t and -e switches tell groff to preprocess using tbl and eqn.
  674.   This is overkill for man pages that don't require preprocessing but it
  675.   doesn't harm apart from a few CPU cycles wasted. On the other hand,
  676.   not using -t when it is actually required does harm: the table is
  677.   terribly formatted.  You can even find out (well, "guess" is a better
  678.   word) what command is needed to format a certain groff document (not
  679.   just man pages) by issuing
  680.  
  681.   funnyprompt% grog /usr/man/man7/signal.7
  682.   groff -t -man /usr/man/man7/signal.7
  683.  
  684.   "Grog" stands for "GROff Guess", and it does what it says--guess, if
  685.   it were perfect we wouldn't need options any more. I've seen it guess
  686.   wrong on macro packages, but never on preprocessors.
  687.  
  688.  
  689.  10)  How do I get a high quality PostScript manual page?
  690.       ===================================================
  691.  
  692.   funnyprompt% groff -t -e -mandoc -Tps manpage.1 > manpage.ps
  693.  
  694.   Print that using your favorite PostScript printer/interpreter.
  695.   See question 9) for explanation of options.
  696.  
  697.  
  698.  
  699.  11)  How do I get `apropos' and `whatis' to work?
  700.       ============================================
  701.  
  702.   Suppose you wonder what compilers are installed on your system and how
  703.   these can be invoked. To answer this (frequently asked) question you say
  704.  
  705.   funnyprompt% apropos compiler
  706.   f77 (1) - Fortran 77 compiler
  707.   gcc (1) - GNU C and C++ compiler
  708.   pc (1) - Pascal compiler
  709.   
  710.   Apropos and whatis are used to give a quick response which man page
  711.   has information on a certain topic. Both programs search a number
  712.   of files named `whatis' that may be found in each of the manual base
  713.   directories.  Like I said before, the whatis data base files contain
  714.   a one line entry for any man page in the respective directory tree. In
  715.   fact, that line is exactly the NAME section (to be precise: joined on
  716.   one line and with hyphenation removed, also note that the section is
  717.   mentioned within parentheses). The whatis data base files are created
  718.   with the makewhatis(8) program. There are several versions around,
  719.   so please refer to the man page what options are available. In order
  720.   for makewhatis to be able to extract the NAME sections correctly it
  721.   is important that you, the manual writer, adhere to the NAME section
  722.   format described under paragraph 2).  The difference between apropos
  723.   and whatis is where in the line and what they are looking for. Apropos
  724.   (which is equivalent to man -k) searches the argument string anywhere on
  725.   the line whereas whatis (equivalent to man -f) tries to match a complete
  726.   command name only on the part before the dash. Consequently, `whatis
  727.   cc' will report if there is a cc manual and remain quiet for gcc.
  728.  
  729.  
  730.                  Corrections and suggestions welcome!
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  A)  Copying conditions
  737.      ==================
  738.  
  739.  Copyright 1995 by Jens Schweikhardt
  740.  <jens@kssun3.rus.uni-stuttgart.de>
  741.  Voice: ++49 7151 690270
  742.  
  743. Unless otherwise stated, Linux HOWTO documents are copyrighted by
  744. their respective authors. Linux HOWTO documents may be reproduced and
  745. distributed in whole or in part, in any medium physical or electronic,
  746. as long as this copyright notice is retained on all copies. Commercial
  747. redistribution is allowed and encouraged; however, the author would like
  748. to be notified of any such distributions.
  749.  
  750. All translations, derivative works, or aggregate works incorporating
  751. any Linux HOWTO documents must be covered under this copyright notice.
  752. That is, you may not produce a derivative work from a HOWTO and impose
  753. additional restrictions on its distribution. Exceptions to these rules
  754. may be granted under certain conditions; please contact the Linux HOWTO
  755. coordinator at the address given below.
  756.  
  757. In short, we wish to promote dissemination of this information through
  758. as many channels as possible. However, we do wish to retain copyright
  759. on the HOWTO documents, and would like to be notified of any plans to
  760. redistribute the HOWTOs.
  761.  
  762. If you have questions, please contact Greg Hankins, the Linux HOWTO
  763. coordinator, at gregh@sunsite.unc.edu via email, or at +1 404 853 9989.
  764.  
  765.